// src/router/dynamicRoutes.ts
import type { RouteRecordRaw } from 'vue-router'

export const dynamicRoutes: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/home',
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/views/HomeView/index.vue'),
    meta: {
      title: '首页',
      roles: ['admin', 'user'],
    },
  },
  {
    path: '/drive',
    name: 'drive',
    component: () => import('@/views/DriveView/index.vue'),
    meta: {
      title: '行驶控制页面',
      roles: ['admin', 'user'],
    },
  },
  {
    path: '/setting',
    name: 'setting',
    component: () => import('@/views/SettingView/index.vue'),
    meta: {
      title: '设置页面',
      roles: ['admin', 'user'],
    },
  },
  {
    path: '/test',
    name: 'test',
    component: () => import('@/views/TestView/index.vue'),
    meta: {
      title: '测试页面',
      roles: ['admin'], // 仅管理员访问
    },
  },
]
